package com.aaa.config;

//@Configuration
public class GlobalConfig {
    /*@Bean
    @Order(0)
    public CorsFilter corsFilter(){
        CorsConfiguration corsConfiguration = new CorsConfiguration();
        // 允许请求带有验证信息
        corsConfiguration.setAllowCredentials(true);
        // 允许请求域名
        corsConfiguration.addAllowedOrigin("http://localhost:8080");
        // 允许请求头
        corsConfiguration.addAllowedHeader("*");
        // 允许请求方式
        corsConfiguration.setAllowedMethods(Arrays.asList("POST"));
        //corsConfiguration.setAllowedMethods(Arrays.asList({"GET","POST"}}));
        UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();
        urlBasedCorsConfigurationSource.registerCorsConfiguration("/**",corsConfiguration);
        return new CorsFilter(urlBasedCorsConfigurationSource);
    }*/
}
